<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
$user = new Models_User ;
?>
<div class="maincomment">
<form action="/<?php echo $user->path ; ?>user/register" method="POST">
    Логiн <input name="login" type="text" value="<?php if(isset ($login)) echo $login ; ?>" class="input"><br>
Пароль <input name="pass" type="password" class="input"><br>
email <input name="email" type="email" value="<?php if(isset ($login)) echo $email ; ?>" class="input"><br>
<input name="submit" type="submit" value="register">
</form>
</div>

<?php
if(isset ($_POST['submit']))
{
    $noErr = $user->isValid($login, $email,$pass) ;
    if($noErr === TRUE)
    {
        $user->setUser($login,$pass,$email) ;
    } else {
        echo '<div class="subcomment">
            <ul>' ;
        foreach ($noErr as $errors)
        {
            echo '<li>'.$errors . '</li>' ;
        }
        echo '</ul></div>' ;
    }
}
?>
